home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / ms-0_06.lha / bms-0.06 / work.h < prev   
C/C++ Source or Header  |  1993-08-06  |  2KB  |  59 lines

  1. /* work.h - public definitions for work distribution module */
  2. /* Copyright (C) 1991 Andreas Gustafsson */
  3.  
  4. /* **************** types **************** */
  5.  
  6. typedef struct wf_state wf_state;
  7.  
  8.  
  9. /* **************** public functions **************** */
  10.  
  11. /* wf=wf_init(timeout): initialize work distribution system.  "timeout" 
  12.   should be well larger than the time to complete a single work packet 
  13.   (in milliseconds) */
  14. struct wf_state *wf_init();
  15.  
  16. /* wf_dispatch_chunk(wf, client, client_data, client_datalen, 
  17.      slave_data, slave_datalen): give a piece of work to the workforce */
  18. void wf_dispatch_chunk();
  19.  
  20. /* wf_restart(wf): make sure the computation servers are at work */
  21.  
  22. /* wf_handle_socket_input(wf, client_data): call this when input available */
  23. void wf_handle_socket_input();
  24.  
  25. /* wf_timed_out(client_data): call when timeout has occurred */
  26. void wf_timed_out();
  27.  
  28. /* wf_client_died(): call when client no longer wants wf_draw() calls
  29.    despite outstanding requests */
  30. void wf_client_died();
  31.  
  32. /* wf_print_stats(wf): print statistics about server performance */
  33. void wf_print_stats();
  34.  
  35. /* wf_socket(wf): get the fd of the slave communications socket
  36.   (for select) */
  37. int wf_socket();
  38.  
  39.  
  40.  
  41. /* **** external functions called from work.c, user must define **** */
  42.  
  43. /* misc. services */
  44. char *wf_alloc();     /* malloc() or equivalent */
  45. char *wf_realloc();    /* realloc() or equivalent */
  46. void wf_free();        /* free() or equivalent */
  47. void wf_error();    /* print msg and exit */
  48. void wf_warn();        /* print msg */
  49.  
  50. /* wf_add_timeout(millisecs, client_data): cause a call to
  51.    wf_timed_out(client_data) after millisecs have passed; return id */
  52. char *wf_add_timeout();
  53.  
  54. /* wf_remove_timeout(id): cancel timeout identified by id */
  55. void wf_remove_timeout();
  56.  
  57. /* wf_draw(client, client_data, reply_data): handle incoming data */
  58. void wf_draw();
  59.